<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div class=" definewidth m20">
		<form id="searchForm" action="/sys_admin/accountrecharge/zhs_accountrechargelist/" method="get"class="form-inline definewidth m20">
	  			用户名：<input type="text" id="username" name="username" style="width: 100px;" value="<?php echo $username?>" />
	  			实名：<input type="text" id="realname" name="realname" style="width: 100px;" value="<?php echo $realname?>" />
	  			用户类型：<select id="is_loan" name="is_loan" style="width: 100px;">
	  				<option value="-1" <?php if($is_loan==-1){?>selected="selected"<?php }?>>所有</option>
	  				<?php foreach($user_loan as $key=>$value){?>
	  				<option value="<?php echo $key?>" <?php if($is_loan==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
	  				<?php }?>
	  			</select>
	  			状态：<select id="fstatus" name="fstatus" style="width: 120px;">
	  				<option value="-1" <?php if($fstatus==-1){?>selected="selected"<?php }?>>所有</option>
	  				<?php foreach($account_recharge_status as $key=>$value){?>
	  				<option value="<?php echo $key?>" <?php if($fstatus==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
	  				<?php }?>
	  			</select>
	  			类型：<select id="ftype" name="ftype"  style="width: 100px;">
	  				<option value="-1" <?php if($ftype==-1){?>selected="selected"<?php }?>>所有</option>
	  				<?php foreach($account_recharge_type as $key=>$value){?>
	  				<option value="<?php echo $key?>" <?php if($ftype==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
	  				<?php }?>
	  			</select>
	  			开始时间：<input type="text" id="strtime" name="strtime" style="width: 100px;" value="<?php echo $strtime;?>"  onfocus="WdatePicker()" class="Wdate" />
	  			结束时间：<input type="text" id="endtime" name="endtime" style="width: 100px;" value="<?php echo $endtime;?>"  onfocus="WdatePicker()" class="Wdate" />
	  			<button type="button" class="btn btn-primary"  onclick="this.form.submit();" >查询</button>
	  			<button type="button" class="btn btn-success"  onclick="href('/sys_admin/accountrecharge/accountrechargeexcel/?username=<?php echo $username;?>&realname=<?php echo $realname;?>&is_loan=<?php echo $is_loan;?>&fstatus=<?php echo $fstatus;?>&ftype=<?php echo $ftype;?>&strtime=<?php echo $strtime;?>&endtime=<?php echo $endtime;?>');" >导出数据</button>
	  	</form>
		<table class="table table-bordered table-hover definewidth m10">
			 <thead>
			    <tr>
			        <th><strong>ID</strong></th>
					<th><strong>用户名</strong></th>
					<th><strong>姓名</strong></th>
					<th><strong>类型</strong></th>
					<th><strong>订单号</strong></th>
					<th><strong>金额</strong></th>
					<th><strong>手续费</strong></th>
					<th><strong>类型</strong></th>
					<th><strong>备注</strong></th>
					<th><strong>充值时间</strong></th>
					<th><strong>审核时间</strong></th>
					<th><strong>状态</strong></th>
					<!--
					<th><strong>操作</strong></th>
					-->
			    </tr>
			   </thead>
			  <?php foreach($accountrecharge_list as $key=>$accountrecharge){?>
			  <tr>
			  	<td><?php echo $accountrecharge['id'];?></td>
				<td><a href="javascript:search('<?php echo $accountrecharge['username'];?>');"><?php echo $accountrecharge['username'];?></a></td>
				<td><?php echo $accountrecharge['realname'];?></td>
				<td><?php echo $user_loan[intval($accountrecharge['is_loan'])];?></td>
				<td><?php echo $accountrecharge['trade_no'];?></td>
				<td><?php echo number_format($accountrecharge['money'],2);?></td>
				<td><?php echo number_format($accountrecharge['fee'],2);?></td>
				<td><?php echo $account_recharge_type[$accountrecharge['ftype']];?></td>
				<td><?php echo $accountrecharge['remark'];?></td>
				<td><?php echo date('m-d H:i', $accountrecharge['add_time']);?></td>
				<td><?php if($accountrecharge['fstatus'] > 0){?><?php echo date('m-d H:i', $accountrecharge['verify_time']);?><?php }?></td>
				<td><?php echo $account_recharge_status[$accountrecharge['fstatus']];?></td>
				<!--<td>
					
				<?php if($accountrecharge['fstatus'] == 0){?>
					<a href="javascript:verify(<?php echo $accountrecharge['id'];?>);">审核</a>				
				<?php }?>
				</td>
				-->
			  </tr>
			  <?php }?>
			  	<tr>
			  	<td colspan="12"  class="invbd_page"><?php echo $this->pagination->create_links();?></td>
			  	</tr>
		</table>
</div>
<div id="dialog" title="系统提示" style="display:none;">
	<div id="msg" style="text-align:center;color:red">&nbsp;</div>
	<input type="hidden" name="id" id="id" />
	状态： <input type="radio" name="fstatus" id="fstatus" checked="checked" value="1"/>验证 宝付
	<input type="hidden" name="fstatus" id="fstatus" value="2"/> <br /><br /> 
	备注/结果：<textarea  id="verify_remark" name="verify_remark" style="width: 300px;height: 100px;">待确认宝付是否充值成功</textarea><br/>
</div>
<script>
function search(username){
	$("#username").val(username);
	$("#searchForm").submit();
}

function verify(id){
	if(id>0){
		$( "#dialog" ).dialog({
			width:400,
			modal:true, //蒙层（弹出会影响页面大小）
			title:'充值验证',
			buttons:{"提交":function(){verifysub();},"关闭":function(){$(this).dialog("close");}}
		});
		$("#id").val(id);
	}
}

function verifysub(){
	$( "#dialog" ).dialog();
	if($('#verify_remark').val() == ''){
		$("#msg").html("请填写备注");
		return false;
	}
	$.ajax({
		type: "POST",
		url: "/sys_admin/accountrecharge/verify",
		data: "id="+$('#id').val()+"&fstatus="+$('input:radio[name="fstatus"]:checked').val()+"&verify_remark="+$('#verify_remark').val(),
		success: function(msg){
	        $( "#dialog" ).dialog();
	        if(msg=='1'){
	        	$("#verify_remark").val("宝付反馈结果：充值成功");
	        }else{
	        	$("#verify_remark").val(msg);
		    }
			setTimeout(function(){
					location.reload();
			},3000);
		},
		dataType: "text"
	});
}
</script>
